package demo1;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        System.out.println("线程之前的代码");
        Thread thread = new Thread(() -> {
            while(true){
                System.out.print("线程时的代码");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        thread.start();
        thread.join();
        System.out.println("线程之后的代码");
    }
}
